import com.sun.javafx.geom.Edge;
import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.edge.EdgeOptions;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Li_yizYa
 * Date: 2025/9/18
 * Time: 17:48
 */
public class autoTest02 {
    public void test01() {
        //驱动管理程序下载驱动
        WebDriverManager.edgedriver().setup();
        EdgeOptions options = new EdgeOptions();
        //允许访问所有链接
        options.addArguments("--remote-allow-origins=*");

        //1.驱动打开浏览器--打开了浏览器
        WebDriver driver = new EdgeDriver(options);
        //2.请求百度网址：https://www.baidu.com/
        driver.get("https://www.baidu.com/");
        //3.找到百度输入框，并输入关键词“迪丽热巴”
        driver.findElement(By.cssSelector("#kw")).sendKeys("迪丽热巴");
        //4.找到百度一下按钮，并点击
        driver.findElement(By.cssSelector("#su")).click();
        //5.关闭浏览器
        driver.quit();
    }
}
